import Taro, {Component} from '@tarojs/taro'
import {View, Button, Text, Swiper, SwiperItem, Image, ScrollView} from '@tarojs/components'
import {connect} from '@tarojs/redux'
import {
  set_userinfo, set_cart, set_goodslist, set_viplist, set_bind_car_num, set_progress,
  set_pushdata, set_pushdatanum, gohome_btn, set_cart_num,
} from '../../actions/IndexAction'
import base from "../base"
import './index.less'
import set from "../../apis/api"
import ListScrollView from "../../components/lpui/ListScrollView"
import {AtList, AtListItem} from "taro-ui"
let page=0;
//VAL表示值，GZ表示故障，SW表示开关状态，ZF表示正反转，GW表示功率档位，RUN表示空调运行状态，V表示电压，A表示电流，1A为交流电压，2A为交流电流
const attrValue={
  VAL:"值",
  GZ:"故障",
  SW:"开关状态",
  ZF:"正反转",
  GW:"功率档位",
  RUN:"空调运行状态",
  V:"电压",
  A:"电流",
  "1A":"交流电压",
  "2A":"交流电流",
}
const  width =wx.getSystemInfoSync().windowWidth;
class device_detail extends Component {
  constructor(props) {
    super(props)
    base(this)
    this.state = {
      sild: [],
      atList: [],
      detail:null,
      log:[],
      jz_status:1,
      attrList:[],
    }
  }
  config = {
    navigationBarTitleText: '设备详情',
    enablePullDownRefresh: true,
    navigationBarBackgroundColor: "#4bb33d",
    navigationBarTextStyle: "white"

  }
  onReachBottom() {


  }
  componentWillReceiveProps(nextProps) {
    console.log(this.props, nextProps)
  }
  onPullDownRefresh() {
    this.getDeviceDetail()


    wx.stopPullDownRefresh();
  }
  getDeviceAttr() {
    wx.showLoading({title: "加载中"})
    var databody = {
      access_token: this.props.gytoken.gytoken,
      wxid: this.props.sys_config.sets.wxid,
      id:this.state.detail.id
    }
    this.wx_request(set.get_attr, databody, "POST", {'Content-Type': 'application/x-www-form-urlencoded'}).then((data) => {

      if(data.data.data)
      {
        this.setState({
          attrList:data.data.data
        })
      }



      wx.stopPullDownRefresh();
      wx.hideLoading();

    }).catch((err) => {
      wx.hideLoading();
      wx.stopPullDownRefresh();
      wx.showToast({
        title: '网络访问失败，请重试',
        icon: 'none',
        duration: 1800
      })
    })

  }
  componentWillUnmount() {
  }
  componentDidShow() {
    var data=JSON.parse(this.$router.params.item)
    this.setState({
      detail:data
    },()=>{
      this.onPullDownRefresh()
    })
  }
  componentDidMount() {

  }
  back() {
    Taro.navigateBack()
  }
  delDevice(){
    var that=this;
    wx.showModal({
      title: '删除提示',
      content: '您确认删除此设备么',
      cancelText:'取消',
      confirmText:'删除',
      success(res){
        if(res.confirm)
        {
          Taro.navigateTo({
            url: '/pages/gypage/option_set?action=del&id='+that.state.detail.id+"&dev_sn="+that.state.detail.d_sn+"&code="+that.state.detail.code
          })

        }
      }
    })


  }


  sendAt(item)
  {
    if(this.state.detail&&this.state.detail.e_status==0)
    {
      return;
    }
    wx.showLoading({title: "发送中"})
    var databody = {
      access_token: this.props.gytoken.gytoken,
      wxid: this.props.sys_config.sets.wxid,
      at_id: item.id,
      d_sn: this.state.detail.d_sn
    }
    this.wx_request(set.sendat, databody, "POST", {'Content-Type': 'application/x-www-form-urlencoded'}).then((data) => {

      console.log(data)



      wx.stopPullDownRefresh();
      wx.hideLoading();
      wx.showToast({title: "设置"+item.name+"成功", icon: "none"})

    }).catch((err) => {
      wx.hideLoading();
      wx.stopPullDownRefresh();
      wx.showToast({
        title: '网络访问失败，请重试',
        icon: 'none',
        duration: 1800
      })
    })


  }


  loadMore(callback)
  {
    wx.showLoading({title: "加载中"})
    var databody = {
      access_token: this.props.gytoken.gytoken,
      wxid: this.props.sys_config.sets.wxid,
      d_sn: this.state.detail.d_sn,
      code: this.state.detail.code,
      start_date:"2019-01-01 00:00:00",
      end_date:"2030-01-08 00:00:00",
      limit:page*20+","+"20",
    }

    this.wx_request(set.get_date_range_data, databody, "POST", {'Content-Type': 'application/x-www-form-urlencoded'}).then((data) => {

      if(data.data.data&&data.data.data.length>0)
      {
        page++;
        this.setState({
          log:data.data.data
        })
      }
      wx.hideLoading();
      wx.stopPullDownRefresh();
      callback&&callback(true);

    }).catch((err) => {
      wx.hideLoading();
      wx.stopPullDownRefresh();
      callback&&callback();
      wx.showToast({
        title: '网络访问失败，请重试',
        icon: 'none',
        duration: 1800
      })
    })

  }
  refresh(callback)
  {
    wx.showLoading({title: "加载中"})
    page=0;
    var databody = {
      access_token: this.props.gytoken.gytoken,
      wxid: this.props.sys_config.sets.wxid,
      d_sn: this.state.detail.d_sn,
      code: this.state.detail.code,
      start_date:"2019-01-01 00:00:00",
      end_date:"2030-01-08 00:00:00",
      limit:page*20+","+"20",
    }

    this.wx_request(set.get_date_range_data, databody, "POST", {'Content-Type': 'application/x-www-form-urlencoded'}).then((data) => {
      if(data.data.data&&data.data.data.length>0)
      {
        page++;
        this.setState({
          log:data.data.data
        })
      }

      wx.hideLoading();
      wx.stopPullDownRefresh();
      callback&&callback();

    }).catch((err) => {
      wx.hideLoading();
      wx.stopPullDownRefresh();
      callback&&callback();
      wx.showToast({
        title: '网络访问失败，请重试',
        icon: 'none',
        duration: 1800
      })
    })

  }
  getRangeData() {
    wx.showLoading({title: "加载中"})
    var databody = {
      access_token: this.props.gytoken.gytoken,
      wxid: this.props.sys_config.sets.wxid,
      d_sn: this.state.detail.d_sn,
      code: this.state.detail.code,
      start_date:"2019-01-01 00:00:00",
      end_date:"2030-01-08 00:00:00",
      limit:"3,2"
    }
    this.wx_request(set.get_date_range_data, databody, "POST", {'Content-Type': 'application/x-www-form-urlencoded'}).then((data) => {

      console.log("log:",data)



      wx.stopPullDownRefresh();
      wx.hideLoading();

    }).catch((err) => {
      wx.hideLoading();
      wx.stopPullDownRefresh();
      wx.showToast({
        title: '网络访问失败，请重试',
        icon: 'none',
        duration: 1800
      })
    })

  }
  getJzStatus() {
    wx.showLoading({title: "加载中"})
    var databody={
      access_token:this.props.gytoken.gytoken,
      wxid:this.props.sys_config.sets.wxid,
      id:this.state.detail.b_id
    }
    this.wx_request(set.get_data, databody,"POST", {'Content-Type': 'application/x-www-form-urlencoded'}).then((data)=>
    {

      var detail=data.data.data;
      console.log("jz_detail",detail)
      this.setState({
        jz_status:detail.status,
      })



    }).catch((err)=>{
      wx.hideLoading();
      wx.stopPullDownRefresh();
      wx.showToast({
        title: '网络访问失败，请重试',
        icon: 'none',
        duration: 1800
      })
    })

  }
  getDeviceDetail() {
    wx.showLoading({title: "加载中"})
    var databody = {
      access_token: this.props.gytoken.gytoken,
      wxid: this.props.sys_config.sets.wxid,
      S_id:this.state.detail.id
    }
    this.wx_request(set.get_details, databody, "POST", {'Content-Type': 'application/x-www-form-urlencoded'}).then((data) => {

      console.log('detail',data)
      this.setState({
        detail:data.data.data
      },()=>{
        this.loadMore();
        this.getDeviceAt();
        this.getDeviceAttr();
        this.getJzStatus()
      })



      wx.stopPullDownRefresh();
      wx.hideLoading();

    }).catch((err) => {
      wx.hideLoading();
      wx.stopPullDownRefresh();
      wx.showToast({
        title: '网络访问失败，请重试',
        icon: 'none',
        duration: 1800
      })
    })

  }
  getDeviceAt() {
    wx.showLoading({title: "加载中"})
    var databody = {
      access_token: this.props.gytoken.gytoken,
      wxid: this.props.sys_config.sets.wxid,
      S_e_id:this.state.detail.e_id
    }
    this.wx_request(set.get_at_list, databody, "POST", {'Content-Type': 'application/x-www-form-urlencoded'}).then((data) => {

      console.log(data)
      if (data.data && data.data.data && data.data.data.data) {
        this.setState({
          atList: data.data.data.data
        })
      }

      wx.stopPullDownRefresh();
      wx.hideLoading();

    }).catch((err) => {
      wx.hideLoading();
      wx.stopPullDownRefresh();
      wx.showToast({
        title: '网络访问失败，请重试',
        icon: 'none',
        duration: 1800
      })
    })

  }



  componentDidHide() {
  }

  render() {
    const {atList,detail,log,attrList}=this.state;
    let btn_background="#32b16c";
    if(detail&&detail.e_status==0)
    {
      btn_background="#d2d2d2"
    }
    return (
      <View style={{paddingBottom:"0rpx"}}>
        <View>
          <ScrollView>
            {detail&&
              <Image src={detail.big_img} style={{width:width+"px"}} mode={"widthFix"}/>
            }
            {/*<View style={{padding: "20rpx"}}>*/}
              {/*<View style={{backgroundColor: "#32b16c", borderRadius: "10rpx", display: "flex", overflow: "hidden"}}>*/}
                {/*<View style={{flex: 1, padding: "10rpx"}}>*/}
                  {/*<View style={{backgroundColor: "#32b16c", display: "flex", padding: "10rpx"}}>*/}
                    {/*<View style={{backgroundColor: "#32b16c", display: "flex", flex: 1}}>*/}
                      {/*<View style={{backgroundColor: "#32b16c", display: "flex"}}>*/}
                        {/*<View style={{width: "50rpx", height: "50rpx"}}>*/}
                          {/*x*/}
                        {/*</View>*/}
                        {/*<View style={{width: "50rpx", height: "50rpx"}}>*/}
                          {/*x*/}
                        {/*</View>*/}
                        {/*<View style={{width: "50rpx", height: "50rpx"}}>*/}
                          {/*x*/}
                        {/*</View>*/}
                      {/*</View>*/}


                    {/*</View>*/}
                    {/*<View style={{*/}
                      {/*display: "flex",*/}
                      {/*backgroundColor: "#ffffff",*/}
                      {/*height: "40rpx",*/}
                      {/*borderRadius: "20rpx",*/}
                      {/*paddingLeft: "20rpx",*/}
                      {/*paddingRight: "20rpx",*/}
                      {/*alignItems: "center",*/}
                      {/*justifyContent: "center"*/}
                    {/*}}>*/}
                      {/*<Text style={{color: "#333333", fontSize: "22rpx", fontWeight: "bold"}}> 设备编号 KD0023</Text>*/}
                    {/*</View>*/}
                  {/*</View>*/}
                  {/*<View style={{backgroundColor: "#ffffff", borderRadius: "20rpx", padding: "10rpx",}}>*/}
                    {/*<View style={{padding: "10rpx", display: "flex"}}>*/}
                      {/*<View style={{display: "flex", flex: 1}}>*/}
                        {/*<View style={{*/}
                          {/*height: "40rpx", borderRadius: "20rpx", backgroundColor: "#90c81f", alignItems: "center",*/}
                          {/*justifyContent: "center", display: "flex", flex: 1*/}
                        {/*}}>*/}
                          {/*<Text style={{color: "#ffffff", fontSize: "22rpx"}}>交流电压</Text>*/}
                        {/*</View>*/}
                        {/*<View style={{*/}
                          {/*height: "40rpx", borderRadius: "20rpx", width: "60rpx", alignItems: "center",*/}
                          {/*justifyContent: "center", display: "flex", paddingLeft: "20rpx",*/}
                          {/*paddingRight: "20rpx",*/}
                        {/*}}>*/}
                          {/*<Text style={{color: "#333333", fontSize: "22rpx"}}>231V</Text>*/}
                        {/*</View>*/}


                      {/*</View>*/}
                      {/*<View style={{display: "flex", flex: 1}}>*/}
                        {/*<View style={{*/}
                          {/*height: "40rpx", borderRadius: "20rpx", backgroundColor: "#526db2", alignItems: "center",*/}
                          {/*justifyContent: "center", display: "flex", flex: 1*/}
                        {/*}}>*/}
                          {/*<Text style={{color: "#ffffff", fontSize: "22rpx"}}>负载电流</Text>*/}
                        {/*</View>*/}
                        {/*<View style={{*/}
                          {/*height: "40rpx", borderRadius: "20rpx", width: "60rpx", alignItems: "center",*/}
                          {/*justifyContent: "center", display: "flex", paddingLeft: "20rpx",*/}
                          {/*paddingRight: "20rpx",*/}
                        {/*}}>*/}
                          {/*<Text style={{color: "#333333", fontSize: "22rpx"}}>231V</Text>*/}
                        {/*</View>*/}


                      {/*</View>*/}


                    {/*</View>*/}
                    {/*<View style={{padding: "10rpx", display: "flex"}}>*/}
                      {/*<View style={{display: "flex", flex: 1}}>*/}
                        {/*<View style={{*/}
                          {/*height: "40rpx", borderRadius: "20rpx", backgroundColor: "#ae5da0", alignItems: "center",*/}
                          {/*justifyContent: "center", display: "flex", flex: 1*/}
                        {/*}}>*/}
                          {/*<Text style={{color: "#ffffff", fontSize: "22rpx"}}>直流电压</Text>*/}
                        {/*</View>*/}
                        {/*<View style={{*/}
                          {/*height: "40rpx", borderRadius: "20rpx", width: "60rpx", alignItems: "center",*/}
                          {/*justifyContent: "center", display: "flex", paddingLeft: "20rpx",*/}
                          {/*paddingRight: "20rpx",*/}
                        {/*}}>*/}
                          {/*<Text style={{color: "#333333", fontSize: "22rpx"}}>231V</Text>*/}
                        {/*</View>*/}


                      {/*</View>*/}
                      {/*<View style={{display: "flex", flex: 1}}>*/}
                        {/*<View style={{*/}
                          {/*height: "40rpx", borderRadius: "20rpx", backgroundColor: "#ec6876", alignItems: "center",*/}
                          {/*justifyContent: "center", display: "flex", flex: 1*/}
                        {/*}}>*/}
                          {/*<Text style={{color: "#ffffff", fontSize: "22rpx"}}>系统状态</Text>*/}
                        {/*</View>*/}
                        {/*<View style={{*/}
                          {/*height: "40rpx", borderRadius: "20rpx", width: "60rpx", alignItems: "center",*/}
                          {/*justifyContent: "center", display: "flex", paddingLeft: "20rpx",*/}
                          {/*paddingRight: "20rpx",*/}
                        {/*}}>*/}
                          {/*<Text style={{color: "#333333", fontSize: "22rpx"}}>231V</Text>*/}
                        {/*</View>*/}


                      {/*</View>*/}


                    {/*</View>*/}


                  {/*</View>*/}
                  {/*<View style={{*/}
                    {/*backgroundColor: "#32b16c",*/}
                    {/*display: "flex",*/}
                    {/*padding: "10rpx",*/}
                    {/*alignItems: "center",*/}
                    {/*justifyContent: "center"*/}
                  {/*}}>*/}
                    {/*<View style={{width: "50rpx", height: "50rpx"}}>*/}
                      {/*x*/}
                    {/*</View>*/}
                    {/*<View style={{width: "50rpx", height: "50rpx"}}>*/}
                      {/*x*/}
                    {/*</View>*/}
                    {/*<View style={{width: "50rpx", height: "50rpx"}}>*/}
                      {/*x*/}
                    {/*</View>*/}
                    {/*<View style={{width: "50rpx", height: "50rpx"}}>*/}
                      {/*x*/}
                    {/*</View>*/}

                  {/*</View>*/}
                {/*</View>*/}


                {/*<View style={{width: "200rpx", backgroundColor: "#009843"}}>*/}

                  {/*xxx*/}
                {/*</View>*/}

              {/*</View>*/}


            {/*</View>*/}

            {/*<View style={{padding:"10rpx",display:"flex"}}>*/}
            {/*<View style={{width:"40rpx"}}>*/}
            {/*x*/}
            {/*</View>*/}
            {/*<View style={{flex:1}}>*/}
            {/*<Text style={{color: "#999999", fontSize: "26rpx"}}>*/}
            {/*长沙市金星北路100号*/}
            {/*</Text>*/}
            {/*</View>*/}
            {/*<View>*/}
            {/*<View style={{display:"flex",borderRadius:"25rpx",backgroundColor:"#32b16c",paddingRight:"20rpx",paddingLeft:"20rpx",height:"50rpx"}}>*/}
            {/*<View style={{width:"30rpx"}}>*/}
            {/*x*/}
            {/*</View>*/}
            {/*<View style={{flex:1,display:"flex",alignItems:"center",justifyContent:"center"}}>*/}
            {/*<Text style={{color: "#ffffff", fontSize: "24rpx"}}>*/}
            {/*一键导航*/}
            {/*</Text>*/}
            {/*</View>*/}

            {/*</View>*/}

            {/*</View>*/}

            {/*</View>*/}
            <View >

            </View>
            <View style={{padding: "10rpx", display: "flex", backgroundColor: "#f0f2f5", height: "70rpx",alignItems:"center"}}>
              <View style={{width: "10rpx",borderRadius:"5rpx",height:"60%", backgroundColor: "#4aad36"}}>

              </View>
              <View style={{flex: 1, paddingLeft: "10px", display: "flex", alignItems: "center"}}>
                <Text style={{color: "#333333", fontSize: "26rpx"}}>
                  基本信息
                </Text>
              </View>
            </View>
            <View style={{padding: "10rpx", flex:1}}>
              <View style={{display: "flex", borderBottom: "2rpx solid #f0f2f5", padding: "20rpx"}}>
                <View style={{display: "flex", alignItems: "center", justifyContent: "center",width:"100rpx"}}>
                  <Text style={{color: "#666666", fontSize: "26rpx"}}>
                    名称
                  </Text>
                </View>
                <View style={{flex: 1,justifyContent:"flex-end",alignItems:"center",display:"flex"}}>
                  <Text style={{color: "#666666", fontSize: "26rpx"}}>
                    {detail ? detail.name : ""}
                  </Text>
                </View>
              </View>
              <View style={{display: "flex", borderBottom: "2rpx solid #f0f2f5", padding: "20rpx"}}>
                <View style={{display: "flex", alignItems: "center", justifyContent: "center",width:"100rpx"}}>
                  <Text style={{color: "#666666", fontSize: "26rpx"}}>
                    类型
                  </Text>
                </View>
                <View style={{flex: 1,justifyContent:"flex-end",alignItems:"center",display:"flex"}}>
                  <Text style={{color: "#666666", fontSize: "26rpx"}}>
                    {detail ? detail.inc_type : ""}
                  </Text>
                </View>
              </View>
              <View style={{display: "flex", borderBottom: "2rpx solid #f0f2f5", padding: "20rpx"}}>
                <View style={{display: "flex", alignItems: "center", justifyContent: "center",width:"100rpx"}}>
                  <Text style={{color: "#666666", fontSize: "26rpx"}}>
                    状态
                  </Text>
                </View>
                <View style={{flex: 1,justifyContent:"flex-end",alignItems:"center",display:"flex"}}>
                  {(detail&&detail.status==1)?<Text style={{fontSize: "24rpx", color: "#4bb33d", marginLeft: "10rpx"}}>
                    正常运行
                  </Text>:<Text style={{fontSize: "24rpx", color: "#cc0033", marginLeft: "10rpx"}}>
                    运行异常
                  </Text>}
                </View>
              </View>


            </View>
            {attrList&&attrList.length>0&&<View style={{padding: "10rpx", display: "flex", backgroundColor: "#f0f2f5", height: "70rpx",alignItems:"center"}}>
              <View style={{width: "10rpx",borderRadius:"5rpx",height:"60%", backgroundColor: "#4aad36"}}>

              </View>
              <View style={{flex: 1, paddingLeft: "10px", display: "flex", alignItems: "center"}}>
                <Text style={{color: "#333333", fontSize: "26rpx"}}>
                  属性
                </Text>
              </View>
            </View>}
            <View style={{padding: "10rpx", flex:1}}>
              {attrList.map((item,key)=>{
                return (
                  <View key={key} style={{display: "flex", borderBottom: "2rpx solid #f0f2f5", padding: "20rpx"}}>
                    <View style={{display: "flex", alignItems: "center", justifyContent: "center",width:"200rpx"}}>
                      <Text style={{color: "#666666", fontSize: "26rpx"}}>
                        {item.name}
                      </Text>
                    </View>
                    <View style={{flex: 1,justifyContent:"flex-end",alignItems:"center",display:"flex"}}>
                      <Text style={{color: "#666666", fontSize: "26rpx"}}>
                        {item.value?item.value:"未知"}
                      </Text>
                    </View>
                  </View>
                )
              })}




            </View>
            {atList&&atList.length>0&&<View>
            <View style={{padding: "10rpx", display: "flex", backgroundColor: "#f0f2f5", height: "70rpx",alignItems:"center"}}>
              <View style={{width: "10rpx", borderRadius:"5rpx",height:"60%",backgroundColor: "#4aad36"}}>

              </View>
              <View style={{flex: 1, paddingLeft: "10px", display: "flex", alignItems: "center"}}>
                <Text style={{color: "#333333", fontSize: "26rpx"}}>
                  设备控制
                </Text>
              </View>
            </View>
            <View style={{padding: "20rpx 10rpx", display: "flex", flexWrap:"wrap",width:"100%"}}>
              {atList.map((item,key)=>{
                  return (
                    <View key={key} style={{display: "flex", alignItems: "center", justifyContent: "center",width:"30%"}}>
                    <View onClick={this.sendAt.bind(this,item)} style={{
                      width: "90%",
                      borderRadius: "25rpx",
                      height: "50rpx",
                      display: "flex",
                      alignItems: "center",
                      justifyContent: "center",
                      marginBottom:"10rpx",
                      background: btn_background
                    }}>
                      <Text style={{color: "#ffffff", fontSize: "24rpx"}}>
                        {item.name}
                      </Text>
                    </View>
                  </View>)
                })}



            </View>
            </View>}
            <View style={{padding: "10rpx", display: "flex", backgroundColor: "#f0f2f5", height: "70rpx",alignItems:"center"}}>
              <View style={{width: "10rpx",borderRadius:"5rpx",height:"60%", backgroundColor: "#4aad36"}}>

              </View>
              <View style={{flex: 1, paddingLeft: "10px", display: "flex", alignItems: "center"}}>
                <Text style={{color: "#333333", fontSize: "26rpx"}}>
                  运行状态
                </Text>
              </View>
            </View>
            <View  style={{display: "flex", padding: "20rpx",background:"#ffffff",borderBottom:"1px solid #cccccc"}}>
              <View style={{display: "flex", alignItems: "center", justifyContent: "center",width:"160rpx",borderRight:"1px solid #cccccc"}}>
                <Text style={{color: "#666666", fontSize: "26rpx"}}>
                  时间
                </Text>
              </View>
              <View style={{flex: 1,alignItems:"center",display:"flex",paddingLeft:"10rpx",justifyContent:"center"}}>
                <Text style={{color: "#666666", fontSize: "26rpx"}}>
                  事件
                </Text>
              </View>
              <View style={{display: "flex", alignItems: "center", justifyContent: "center",width:"100rpx",borderLeft:"1px solid #cccccc"}}>
                <Text style={{color: "#666666", fontSize: "26rpx"}}>
                  值
                </Text>
              </View>
            </View>
            <View style={{height:"600rpx"}}>

            <ListScrollView
              bottom_height={0}
              onRefresh={this.refresh.bind(this)}
              onLoadMore={this.loadMore.bind(this)}
            >
              {log&&log.length>0&&log.map((item,i)=>{
                return(<View key={i} style={{display: "flex", borderBottom: "2rpx solid #f0f2f5", padding: "20rpx",background:"#ffffff"}}>
                  <View style={{display: "flex", alignItems: "center", justifyContent: "center",width:"161rpx"}}>
                    <Text style={{color: "#999999", fontSize: "20rpx"}}>
                      {this.date(item.add_date)}
                    </Text>
                  </View>
                  <View style={{flex: 1,alignItems:"center",display:"flex",paddingLeft:"10rpx",justifyContent:"center"}}>
                    <Text style={{color: "#666666", fontSize: "26rpx"}}>
                      {item.cn_attr}
                    </Text>
                  </View>
                  <View style={{display: "flex", alignItems: "center", justifyContent: "center",width:"101rpx"}}>
                    <Text style={{color: "#666666", fontSize: "26rpx"}}>
                      {item.d_value}
                    </Text>
                  </View>
                </View>)
              })}

            </ListScrollView>
            </View>



          </ScrollView>
        </View>
        {/*<View style={{display:"flex",alignItems:"center",zIndex:9,justifyContent:"center",background:"#ffffff",height:"120rpx",position:"fixed",bottom:"0",width:"100%",borderTop:"2rpx #eeeeee solid"}}>*/}
          {/*<View onClick={this.delDevice.bind(this)} style={{background:"#32b16c",borderRadius:"35rpx",width:"60%",height:"70rpx",display:"flex",alignItems:"center",justifyContent:"center",}}>*/}
            {/*<Text style={{color:"#ffffff",fontSize:"26rpx"}}>*/}
              {/*删除设备*/}
            {/*</Text>*/}

          {/*</View>*/}

        {/*</View>*/}
      </View>
    )
  }
}

const mapstate = state => {
  return {
    userinfo: state.usermodel,
    cart_num: state.cart_num,
    cart: state.cart,
    goodslist: state.goodslist,
    vip: state.vip,
    progress: state.progress,
    pushdata: state.pushdata,
    wxuser: state.wxusermodel,sys_config:state.sys_config,
    gytoken: state.gytoken
  }
}
export default connect(mapstate)(device_detail)

